package com.springcloud.alibaba.controller;

import com.springcloud.alibaba.service.PaymentServiceHystrix;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author:RenPu
 * @Date: 2020/7/1 10:42
 * @Version: 1.0
 * @description:
 */

@RestController
@Slf4j
public class PaymetHystrixController {

    @Value("${server.port}")
    private String SERVER_PORT;

    @Resource
    private PaymentServiceHystrix paymentServiceHystrix;



    @GetMapping(value = "/payment/hystrix/{id}")
    public String testHystrixJiangJi(@PathVariable  Long id){
        return paymentServiceHystrix.test_OK( id );
    }



    @GetMapping(value = "/payment/hystrixF/{id}")
    public String testHystrixDuan(@PathVariable Integer id){
        return paymentServiceHystrix.test_RONGDUAN( id );
    }



    @GetMapping(value = "/payment/hystrixF/getLocalPort")
    public String getSERVER_PORT(){
        return SERVER_PORT;
    }


}
